package com.createdevelopment.gaoyou;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Window;

@SuppressLint("NewApi")
public class AboutActivity extends FragmentActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_about);
		ActionBar bar = this.getActionBar();
		bar.setTitle("");
		bar.setDisplayUseLogoEnabled(false);
		bar.setDisplayShowHomeEnabled(false);
		bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
		ActionBar.Tab tabA = bar.newTab().setText("高邮土产");  
        ActionBar.Tab tabB = bar.newTab().setText("特色产业");
        Fragment headerFragment= new SpecialFoodFragment();
        Fragment articleFragment = new SpecialIndustryFragment();
        tabA.setTabListener(new MyTabsListener(headerFragment));
        tabB.setTabListener(new MyTabsListener(articleFragment));
        bar.addTab(tabA);
        bar.addTab(tabB);
        

        
	}
	
	protected class MyTabsListener implements ActionBar.TabListener  
    {  
        private Fragment fragment;  
        public MyTabsListener(Fragment fragment)  
        {  
            this.fragment = fragment;  
        }
		@Override
		public void onTabReselected(Tab tab, FragmentTransaction ft) {
			// TODO Auto-generated method stub
			
		}
		@Override
		public void onTabSelected(Tab tab, FragmentTransaction ft) {
			// TODO Auto-generated method stub
			ft.add(R.id.fragment_container, fragment);
			
		}
		@Override
		public void onTabUnselected(Tab tab, FragmentTransaction ft) {
			// TODO Auto-generated method stub
			ft.remove(fragment);
		}  
       
    }
}
